Nfc routing method

ABSTRACT

A near field communication (NFC) router of a mobile device receives a first message from an external NFC device and, in accordance with a first active rule, processes the first message as being targeted to a first host processing device of the mobile device. When the NFC router receives a second message from the external NFC device and detects a bit pattern in the second message indicating that the first host processing device is not an intended target of the second message, the NFC router activates a second rule. When the NFC router receives a further first message from the external NFC device, the NFC router processes the further first message as being targeted to a target host processing device in accordance with the second active rule.

BACKGROUND

Technical Field The present disclosure relates to the field of NFCcommunications, and in particular to a method of routing, in a mobiledevice, NFC messages from an external NFC device to a target host.

Description of the Related Art

Mobile telephones and other types of mobile devices are increasinglybeing equipped with NFC (Near-Field-Communication) interfaces, whichenable them to perform electromagnetic transponder functions in additionto their other functions. In particular, such devices are able toemulate the functions of an electromagnetic transponder, which could beof the contactless card type, or the contactless reader type. Suchfunctionality for example enhances the mobile device, by allowing it tobe used for various applications, for example as an electronic walletallowing payments to be made for accessing services such as transportnetworks.

To emulate the operation of a contactless card, the mobile device isgenerally equipped with a contactless front-end integrated circuit(CLF), also called an NFC router. This router is equipped with a radiofrequency (RF) transceiver front-end coupled to a low-range antenna tomatch the communication capabilities of an electromagnetic transponder.In some applications, a secure element, either integrated in the mobiledevice or contained in a micro-circuit of the subscriber identificationmodule (SIM) or universal SIM, can be used to provide authentication.

NFC communications using a mobile device generally fall within one ofthree main modes of operation: tag emulation, in which the behavior of acertain type of wireless transponder is emulated by the mobile device;peer-to-peer communications, also referred to as P2P, in which bilateralcommunications are provided between the mobile device and anotherdevice; and reader/writer mode, also referred to as PCD (proximitycoupling device), in which the mobile device reads tags by emitting anelectromagnetic field.

BRIEF SUMMARY

The inventors have realized that a technical problem exists inpermitting certain types of tag emulation modes to be distinguished fromothers and routed to the correct target host of the mobile device,rendering it difficult or in some cases impossible to establish NFCcommunications.

In an embodiment, a method of processing, by a near field communicationrouter of a mobile device, messages to a target host processing deviceof the mobile device, comprises: receiving by the NFC router a firstmessage from an external NFC device and, in accordance with a firstactive rule, processing the first message as being targeted to a firsthost processing device of the mobile device; receiving by the NFC routera second message from the external NFC device; detecting by the NFCrouter a bit pattern in the second message indicating that the firsthost processing device is not an intended target of the further messageand activating in consequence a second rule; and receiving by the NFCrouter a further first message from the external NFC device, and inaccordance with the second active rule, processing the further firstmessage as being targeted to the target host processing device.

In an embodiment, activating the second rule comprises storing in amemory an indication that the second rule is active or that the firstrule is deactivated.

In an embodiment, the method further comprises accessing by the NFCrouter, in response to receiving the first message, a lookup tableidentifying, based on at least some of the data bits forming the firstmessage and on whether the first or second rule is active, the firsthost processing device.

In an embodiment, the method further comprises accessing by the NFCrouter, in response to receiving the further first message, the lookuptable, wherein the lookup table further identifies, based on at leastsome of the data bits forming the further first message and on whetherthe first or second rule is active, the target host processing device.

In an embodiment, the method further comprises transmitting by the

NFC router, in response to the first message, a response message to theexternal device.

In an embodiment, the response message comprises an identifier of thefirst host processing device, and the bit pattern is the combination inthe second message of at least part of the identifier of the first hostprocessing device and of one or more bits indicating an NFC applicationtype incompatible with the first host processing device.

In an embodiment, the method further comprises receiving via the NFCrouter a further second message from the external NFC device and inaccordance with the second active rule, routing the further secondmessage to the target host processing device.

In an embodiment, the method further comprises, prior to receiving thefurther second message, transmitting by the NFC router, in response tothe further first message, a further response message to the externaldevice, the further response message comprising an identifier of thetarget host processing device, wherein the further second messagecomprises the identifier of the target host processing device.

In an embodiment, the target host processing device is a secure elementof the mobile device.

In an embodiment, the target host processing device emulates thebehavior of a contactless integrated circuit card.

In an embodiment, the first message and the further first message arepolling messages of NFC RF transmission type F.

In an embodiment, a mobile device comprises: a plurality of hostprocessing devices; and a near field communication router adapted to:receive a first message from an external NFC device and, in accordancewith a first active rule, process the first message as being targeted toa first host processing device of the mobile device; receive a secondmessage from the external NFC device; detect a bit pattern in the secondmessage indicating that the first host processing device is not anintended target of the further message and activate in consequence asecond rule; and receive by the NFC router a further first message fromthe external NFC device, and in accordance with the second active rule,process the further first message as being targeted to the target hostprocessing device.

In an embodiment, the target host processing device is a secure elementof the mobile device.

In an embodiment, the target host processing device is a SIM (subscriberidentification module) circuit or a universal SIM of the mobile device.

In an embodiment, the mobile device further comprises a memory storing alookup table, wherein the lookup table designates, based on at leastsome of the bits forming each of the first messages and on whether thefirst or second rule is active, the first host processing device or thetarget host processing device.

In an embodiment, a device comprises: one or more memories; andprocessing circuitry, which, in operation: responds to a first nearfield communication (NFC) message from an external NFC device byidentifying a processing device of a plurality of processing devices andprocessing the first NFC message based on the identified processingdevice of the plurality of processing devices; determines, based on bitsof a second NFC message received from the external NFC device, whetherthe second NFC message was directed to the identified processing device;and when it is determined that the second NFC message was not directedto the identified processing device of the plurality of processingdevices, responds to a third RFC message by identifying a secondprocessing device of the plurality of processing devices and processingthe third NFC message received from the external NFC device based on thesecond identified processing device. In an embodiment, the devicecomprises an NFC router including the processing circuitry. In anembodiment, the memory stores a look-up table and the processingcircuitry, in operation, identifies processing devices of the pluralityof processing devices and determines whether the second NFC message wasdirected to the identified processing device based on the look-up table.In an embodiment, the first and third NFC messages received from theexternal NFC device are NFC polling messages. In an embodiment, theplurality of processing devices comprise a host processor of a mobiledevice and at least one secure element of the mobile device.

In an embodiment, a system, comprises: a plurality of processingdevices; and a near field communication router, which, in operation:responds to a first near field communication (NFC) message from anexternal NFC device by identifying a processing device of the pluralityof processing devices and processing the first NFC message based on theidentified processing device of the plurality of processing devices;determines, based on bits of a second NFC message received from theexternal NFC device, whether the second NFC message was directed to theidentified processing device; and responds to a third NFC messagereceived from the external NFC device based on the determination.

In an embodiment, the system comprises a memory storing a look-up table,wherein the NFR router, in operation, determines whether the second NFCmessage was directed to the identified processing device based on thelook-up table. In an embodiment, the first and third NFC messagesreceived from the external NFC device are NFC polling messages. In anembodiment, the plurality of processing devices comprise a hostprocessor of a mobile device and at least one secure element of themobile device. In an embodiment, when it is determined that the secondNFC message was not directed to the identified processing device of theplurality of processing devices, the NFC router, in operation,identifies a second processing device of the plurality of processingdevices and processes the third NFC message based on second identifiedprocessing device of the plurality of processing devices. In anembodiment, the NFC router, in operation, responds to the first NFCmessage received from the external NFC device by applying a firstprocessing rule, and, when it is determined that the second NFC messagereceived from the external NFC device was not directed to the identifiedprocessing device, responds to the third NFC message received from theexternal NFC device without applying the first processing rule.

In an embodiment, a non-transitory computer-readable memory medium'scontents cause a near field communication router to perform a method,the method comprising: responding to a first near field communication(NFC) message from an external NFC device by identifying a processingdevice of a plurality of processing devices and processing the first NFCmessage based on the identified processing device of the plurality ofprocessing devices; determining, based on bits of a second NFC messagereceived from the external NFC device, whether the second NFC messagewas directed to the identified processing device; and responding to athird NFC message received from the external NFC device based on thedetermination. In an embodiment, the determining whether the second NFCmessage was directed to the identified processing device is based on alook-up table. In an embodiment, when it is determined that the secondNFC message was not directed to the identified processing device of theplurality of processing devices, the method comprises identifying asecond processing device of the plurality of processing devices andprocessing the third NFC message based on second identified processingdevice of the plurality of processing devices. In an embodiment, themethod comprises responding to the first NFC message received from theexternal NFC device by applying a first processing rule, and, when it isdetermined that the second NFC message received from the external NFCdevice was not directed to the identified processing device, respondingto the third NFC message received from the external NFC device withoutapplying the first processing rule.

BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWINGS

The foregoing and other features and advantages will become apparentfrom the following detailed description of embodiments, given by way ofillustration and not limitation with reference to the accompanyingdrawings, in which:

FIG. 1 schematically illustrates an example of a mobile device capableof NFC communication according to an example embodiment of the presentdisclosure;

FIG. 2 schematically illustrates a mobile device of FIG. 1 in moredetail according to an example embodiment of the present disclosure;

FIG. 3 schematically represents a data packet of an NFC messageaccording to an example embodiment of the present disclosure;

FIG. 4 is a state diagram representing an example of operation of theNFC circuitry of the mobile device of FIG. 2 according to an exampleembodiment of the present disclosure;

FIG. 5 is a table illustrating routing rules according to an exampleembodiment of the present disclosure;

FIG. 6 is a flow diagram illustrating steps in a method of routingmessages according to an example embodiment of the present disclosure;

FIG. 7 is a table illustrating routing rules according to a furtherexample embodiment of the present disclosure; and

FIG. 8 is a flow diagram illustrating steps in a method of routingmessages according to an example embodiment of the present disclosure.

DETAILED DESCRIPTION

In the following description, numerous specific details are given toprovide a thorough understanding of embodiments. The embodiments can bepracticed without one or more of the specific details, or with othermethods, components, materials, etc. In other instances, well-knownstructures, materials, or operations, such as, for example, integratedcircuits, receivers, antennas, processors, logic gates, discretecircuitry, etc., are not shown or described in detail to avoid obscuringaspects of the embodiments.

Reference throughout this specification to “one embodiment” or “anembodiment” means that a particular feature, structure, orcharacteristic described in connection with the embodiment is includedin at least one embodiment. Thus, the appearances of the phrases “in oneembodiment” “according to an embodiment” or “in an embodiment” andsimilar phrases in various places throughout this specification are notnecessarily all referring to the same embodiment. Furthermore, theparticular features, structures, or characteristics may be combined inany suitable manner in one or more embodiments.

The headings provided herein are for convenience only and do notinterpret the scope or meaning of the embodiments.

FIG. 1 schematically illustrates a mobile device 102 capable of NFCcommunications. For example, the mobile device 102 is a mobiletelephone, smart phone, tablet computer, digital media player or thelike, equipped with NFC circuitry (not illustrated in FIG. 1).

On the left-hand side in FIG. 1, the mobile device 102 is shown incommunication with a reader 104, comprising an NFC transponder 106. Forexample, the reader 104 is positioned at an entry barrier of arestricted area, such as a transport network or the like. Alternatively,the reader 104 is positioned at a point of sale in a shop or restaurant.When used with such a reader, the NFC circuitry of the mobile device 102for example operates in a tag emulation mode.

On the right-hand side in FIG. 1, the mobile device 102 is shown incommunication with another mobile device 108 via an NFC interface. Forexample, like mobile device 102, the mobile device 108 is a mobiletelephone, smart phone, tablet computer, digital media player or thelike, equipped with NFC circuitry. When communicating with anothermobile device, the NFC circuitry of the mobile device 102 for exampleoperates in a peer-to-peer mode, and communications are initiated byeither one of the mobile devices.

FIG. 2 schematically illustrates the mobile device 102 in more detailaccording to an example embodiment.

As illustrated, the device 102 for example comprises a contactlessfront-end integrated circuit (CLF) 202, which will be referred to hereinas an NFC router. The NFC router 202 is coupled to an NFC antenna 204,and together the router 202 and antenna 204 provide NFC circuitry foremulating the behavior of an

NFC transponder. The NFC router 202 includes processing circuitry, whichas illustrated comprise a processor P and discrete circuitry DC (e.g.,logic gates, comparators, etc.), which in operation perform the variousfunctions of NFC router 202.

The NFC router 202 is also for example coupled to a host processingdevice (P) 206 of the mobile device 102, which will be referred toherein as the device host. The device host 206 for example comprises oneor more processors under the control of instructions stored in aninstruction memory (INSTR MEM) 208. The NFC router 202 is also forexample coupled to other host processing devices, of which a secureelement (SE) 210, which is for example an embedded SE (eSE), and/or aSIM or universal SIM circuit 212, are illustrated. The circuit 212 isfor example additionally coupled to the device host 206.

The device host 206 is also for example coupled to an antenna 214, whichfor example permits telecommunications within a cellular network.

A memory 216 is for example coupled to the NFC router 202, and stores arouting table, described in more detail below, defining rules forprocessing NFC messages received by the NFC router. In particular, themessages may be considered to be targeted to either the device host 206or one of the secure elements 210, 212. In some embodiments, the memory216 could be integrated with the NFC router 202. In some embodiments,the memory 216 may store instructions, which when executed by theprocessor P of the NFC router 202, facilitate performance of variousfunctions of the NFC router 202.

In some cases, when NFC communications are to be established with themobile device 102 by an external device such as the reader 104 or themobile device 108 of FIG. 1, a polling message is first transmitted bythe external device, and received by the NFC router 202.

FIG. 3 illustrates an example of the format of a data packet of an NFCmessage according to the NFC standard ISO/IEC 18092.

As illustrated, the data packet for example comprises a preamble (PRE)302, which is for example 38 bits or more in length, a synchronizationfield (SYNC) 304, which is for example 6 bits in length, a length field(L) 306, which is for example 8 bits and indicates the total length offrame, a payload (PAYLOAD) 308, and a cyclic redundancy code field (CRC)309. The payload 308 for example includes sub-fields comprising aninstruction code (INS) 310, and one or more data fields. FIG. 3illustrates the case of a polling message, in which the data fieldscomprise two system code fields (SC1, SC2) 312 and 314, which are forselecting a specific application, a request code field (RC) 316 used torequest additional information, and a time slot number TSN 318 used foranti-collision purposes. In the case of a polling message, theinstruction code INS 310 is for example equal to 0x00, and the fields312 and 314 are by default each at the value 0xFF. Throughout thepresent description, the prefix “0x” is used to indicate that eachfollowing character corresponds to a hexadecimal value.

FIG. 4 is a state diagram 400 representing operation of NFC circuitry ofa mobile device in accordance with the NFC forum.

From an idle state “Idle” 402 or sleep state “Sleep AF” 403, when apolling message (labelled “SENSF_REQ” in FIG. 4) is received, there is astate transition to a ready state “Ready F” 404. In general, a pollingmessage received and processed by the NFC router for example permits aPeer-to-Peer or NFC-Forum tag type 1, 2, 3 or 4 to be polled. Themessage “SENSF_REQ” corresponds to a peer-to-peer or NFC-Forum tag type3 polling message. The NFC-Forum tag type 3 protocol, referred tohereafter simply as “type 3”, is also known as FeliCa (“FeliCa” maycorrespond to a registered trademark) and is based on JapaneseIndustrial Standard (JIS) X 6319-4. A Peer-to-Peer or type 3 pollingmessage for example comprises a data packet having the format shown inFIG. 3, and the instruction code INS in field 310 equal to 8 bits withthe value 0x00. Unless the application code values SC1, SC2 in fields312, 314 specify directly a certain target host processing device of themobile device 102, such as the secure element 210 or SIM 212, pollingmessages are assumed by default to be targeted to the host device 206,and in response a return packet is generated to the external deviceincluding in its payload an NFC identifier of the device host 206.

From state 404, if a check/update command (CUP) message is thesubsequent message to be received by the NFC router from the externaldevice, the next state is a Type 3 Card Emulation mode 406, in which thebehavior of a contactless card of the FeliCa type is emulated. The CUPmessage includes the NFC identifier previously communicated to theexternal device. The state 406 may also be entered directly from theidle or sleep states 402, 403 upon reception of the CUP message if itcontains the appropriate identifier of the card emulation device.

Alternatively, if from state 404 the next message is one labelled“ATR_REQ” in FIG. 4 corresponding to a peer-to-peer message of ISO18092, a peer-to-peer mode 410 is entered, also known as the NFC-DEPmode. Such a message comprises a specific instruction code INS havingthe format 0xDX, wherein X is any hexadecimal value. An “ATR_Ready_F”state 412 is then entered, and after that a message comprising a datatransfer instruction code DEP REQ, or an instruction code PSL REQ forallowing the NFC-DEP speed to be changed, received from the externaldevice, may cause a “target F” state 414 to be entered. From either ofthe states 412 or 414 of the peer-to-peer mode 410, a disable requestmessage “DSL_REQ” from the external device will for example return themobile device 102 to the Sleep state 403, and a release request message“RLS_REQ” from the external device will for example return the mobiledevice 102 to the idle state 402.

A problem is that in practice it may be difficult or impossible tosuccessfully enter the card emulation state 406. Indeed, the NFC router202 is coupled to multiple host devices of the mobile device 102, eachof which is potentially the target host for the NFC communications. Forexample, in the case of messages of the peer-to-peer type, the target isthe device host 206 of the mobile device 102, whereas for type 3 tagemulation, the target is for example the secure element 210. However, itis not always possible for the NFC router 202 to identify which host isthe target host directly from the polling message. Furthermore, theexternal reader is generally not compatible with the detection of morethan one host at a time, meaning that the target host can not be changedduring a given NFC message sequence. Further still, there is not time tointerrogate each host to check whether it is the intended target, as forRF technology type F communications, the NFC router 202 generally shouldrespond within only 2.4 ms. Therefore, unless the system code fields SC1and SC2 of the polling message indicate a specific application, and thusa specific target element, messages are for example processed by defaultas being targeted to the device host 206 of the mobile device. Thus anNFC-Forum Tag Type 3 polling message that does not designate a specificapplication will be routed to the device host 206 of the mobile device102, and the response transmitted to the external device will comprisean NFC identifier associated with the host processing device 206. Thesubsequent CUP message will thus include the identifier of the hostprocessing device, and it will be routed to the device host. However, asit does not correspond to a peer-to-peer message having an instructioncode of the form 0xDX, the device host will discard this message, andreturn to the idle state 402. In the absence of a response, the externaldevice may retransmit the CUP message. However, as the identifier usedin the CUP message would still be that of the device host, this messagewill also be discarded. Furthermore, a new polling message sent by theexternal device will result in exactly the same sequence of events,meaning that the card emulation mode in practice can not be entered.

FIG. 5 is a table showing an example of routing rules that are appliedby the NFC router according to at least some embodiments of the presentdisclosure. As indicated above, such a table is for example stored inthe memory 216. In one embodiment, the table can be implemented as alook-up table (LUT).

The table comprises a number of columns to the left of a dividing line501 that correspond to input conditions. These columns include: an RFtechnology column (RF) indicating the NFC RF technology of thecommunication; a number of columns defining certain bits of a receivedmessage, these columns including an index column (INDEX) indicating abyte of the message to be considered, a pattern column (PATTERN),defining certain patterns of bits of the payload, and a mask column(MASK) indicating the bits of the payload that are to be taken intoaccount; a power field (PWR) initiating whether the device is switchedON, switched OFF or its battery is OFF; and a rule set field (RULE SET)indicating which of a plurality of rule sets is active.

According to the example of FIG. 5, the table comprises six rows 502 to512. In order to select one of the rows, the rows are considered in turnfrom the top down, in other words from row 502 to 512. The selected rowis the first row for which all of the input conditions are met.

The table also comprises a number of columns to the right of thedividing line 501 indicating actions to be taken for a selected row ofthe table. A target column (TARGET) indicates how the message is to beprocessed. In the example of FIG. 4, this column indicates whether themessages are to be processed as being targeted to the device host (DH),for example the device 206 of FIG. 2, or to the secure element (SE), forexample the element 210 or 212 in FIG. 2. A disable rule column (DISABLERULE) indicates which rule set, if any, is to be disabled, and a routingactive column (ROUTING ACTIVE) indicates whether or not the routingtable is to be applied for a subsequent message that is received.

The RF column for example indicates the RF technology type F, and theindex column for example designates an index “1” for each row 502 to512, meaning that the a byte “1” of each message is to be considered.Furthermore, the power column for example indicates a value “1” for eachof the rows 502 to 512, meaning for example that the mobile device isswitched ON. For example, in the case that the mobile device is switchedoff, a peer-to-peer operation is not permitted, and by default pollingmessages may be treated as messages of NFC-Forum Tag Type 3.

The patterns defined in the table of FIG. 5 for example correspond tothe bits of the NFC message forming the payload, and in particular thefields 310, 312 and 314 of FIG. 3. The pattern in rows 502 and 504 ofthe table is for example hexadecimal “00FFFF”, which corresponds to apeer-to-peer or NFC-Forum Tag Type 3 polling message, and the mask inrows 502 and 504 is equal to hexadecimal “FFFFFF”, indicating that allof the bits of the pattern are to be taken into account. The pattern inrow 506 is hexadecimal “000002”, which for example corresponds to anNFC-Forum Tag Type 3 polling message in which an application 0x02 isselected directly, and the mask in row 506 is hexadecimal “FFFFFF”. Thepattern in row 508 is hexadecimal “DXV₁ . . . V_(N)”, X being any value,and V₁ to V_(N) the N hexadecimal values of an identifier associatedwith the device host, and the mask in row 508 is hexadecimal “FOF . . .F”, indicating that the second hexadecimal value of the pattern is nottaken into account. The pattern in row 510 is hexadecimal “XXS₁ . . .S_(N)”, where S₁ to S_(N) are the N hexadecimal values associated withthe secure element, and the mask in row 510 is hexadecimal “00F . . .F”, indicating that the first byte of the pattern is not to be takeninto account. The pattern of row 512 is hexadecimal “XXV₁ . . . V_(N)”,and the mask is hexadecimal “00F . . . F”.

In row 502, the rule set column indicates that rule set 0x01 is active,whereas the remaining rows have 0xXX, indicating that any rule set maybe active. While the rule set is designated by 8 bits in the example ofFIG. 5, other coding schemes could be employed using a different numberof bits or bytes.

FIG. 6 is a flow diagram illustrating steps in a method of routingmessages by the NFC router 202 of the mobile device 102 of FIG. 2according to an example embodiment in which it is assumed that themessages are of NFC-Forum Tag Type 3 intended for example for the secureelement 210 of the mobile device.

As shown in FIG. 6, initially the mobile device is in a standby state602, which could correspond to the idle state 402 or sleep state 403 ofFIG. 4.

A polling message is then received from an external device in a step604, which for example corresponds to the message “SENSF_REQ”, and themobile device 102 passes to the “Ready F” state 404 of FIG. 4.

In a subsequent step 606, the routing table as defined in FIG. 5 is usedin order to determine the target host to be associated with the pollingmessage. In FIG. 6, it is assumed that the message has an instructioncode INS equal to 0x00, and that the remaining bits are all at logic“1”, implying that no specific application is selected. Thus either thefirst row 502 or the second row 504 of the table will be selected basedon the rule set that is active, and in step 606 it is determined whetheror not the rule set 0x01 is active. The active rule set is for examplestored in the memory 216 of FIG. 2, or in a dedicated register of theNFC router. In the table of FIG. 5, the rule set 0x01 is a default ruleset that is systematically applied, for example following power-up ofthe NFC router, or if there has been no NFC communication for a certaintime period, such as several minutes. Thus assuming that initially therule set 0x01 is active corresponding to row 502 of the table, the nextstep after step 606 is step 608.

In step 608, the polling message is processed as being targeted to thedevice host 206 in accordance with the target DH indicated in row 502 ofthe table, and application of the routing table is activated for asubsequent message.

In some embodiments, the NFC router 202 responds directly to the pollingmessage by transmitting a return message to the external deviceincluding the identifier of the device host 206 associated withpeer-to-peer communications, which will be called herein NFC-DEP NFCID2and assumed to comprise N values V₁ to V_(N). Alternatively, in someembodiments, for example if the default host is not the device host andis coupled to the NFC router by a relatively fast interface, the pollingmessage may be routed to this host, which then generates the returnmessage to the external device, which is transmitted via the NFC router.

In a subsequent step 610, a further message is received, which is forexample the CUP message as defined by the FeliCa standard. Routing beingactive, the table of FIG. 5 will be applied again to determine how toprocess this message. The CUP message starts with an instruction codeINS not equal to 0xD0, which is reserved for peer-to-peer. It alsoincludes at least part of the identifier NFC-DEP_NFCID2 associated withthe host processing device, labelled as the N hexadecimal values V₁ toV_(N) in the table. Thus the selected row will be the row 512 of thetable, and the message will be routed to the device host 206. However,given that the instruction code will be incompatible with the devicehost 206, the message will be discarded. Furthermore, in accordance withrow 512 of the table, the rule set 0x01 is disabled. For example, therule set parameter is set to 0x00 indicating that there is no activerule set, or it is set to another value such as 0x02, indicating thatanother rule set is active. In any case, the difference will be that,rather than selecting the row 502 of the table, the row 504 will beselected, and thus a different routing rule will be applied.Furthermore, routing is activated for a subsequent message. The flowthen returns to the standby state 602.

A new polling message is then received from the external device in step604, and again the table is consulted. This time, the rule 0x01 has beendisabled, as so the second row 504 of the table will be selected, andthe next step is 612.

In step 612, the message is processed as being targeted to the secureelement in accordance with row 504 of the table, and application of therouting table is activated for a subsequent message. In this case, thepolling message is for example routed to the secure element 210, andthis secure element thus responds with its identifier, which will becalled herein SE_NFCID2, and assumed to comprise N values S₁ to S_(N).

In the subsequent step 614, a further message is received, which is forexample the CUP message as defined by the FeliCa standard. Routing beingactive, the table will be applied again, and this time row 510 of thetable will be selected, given that the identifier is now the hexadecimalvalue S₁ . . . S_(N). NFC communications are thus successfullyestablished between the secure element and the external device.

Row 508 of the table corresponds to the case that the NFC peer-to-peercommunication mode is to be used, and thus following the pollingmessage, a message of the form 0xDXV₁ . . . V_(N) is received from theexternal device. Peer-to-peer communications can then proceed correctlybetween the device host 206 and the external device.

While the embodiment of FIGS. 4, 5 and 6 described above concernsconflicts between NFC peer-to-peer and NFC-Forum Tag Type 3communications, the principles described in relation to that embodimentcould be applied to a broad range of alternative applications and RFtechnologies. An example of such an alternative application will now bedescribed with reference to FIG. 7.

FIG. 7 is a routing table similar to the one of FIG. 5, but correspondsto an application in which the behavior of a MIFARE DESFire contactlesscard is to emulated by the mobile device 102 (the terms MIFARE andDESFire may correspond to registered trademarks). In such anapplication, the messages received by the NFC router 202 are for exampleof RF technology type A, the device host 206 is referred to as auniversal integrated circuit card (UICC), and an embedded secure element(eSE) is used to emulate a contactless card.

Rather than involving a polling message, this example involves a messagereceived following an anti-collision message sequence.

According to the MIFARE DESFire protocol, following an anti-collisionmessage sequence, an application is selected by a message received froman external NFC device that designates a master file (MF), and a furthermessage that designates a dedicated file (DF). In the example of FIG. 7,it is assumed that a first application is designated by the following MFand DF:

MF: 00 00 00

DF: 00 00 01

and a second application is designated by the following MF and DF:

MF: 00 00 00

DF: 00 00 02

Furthermore, it is assumed that the first application is executed by theUICC, and the second application is executed by the eSE. The instruction0x5A means that an application is to be selected, the code 5A00000Xmeaning the application 00000X should be selected.

The table of FIG. 7 comprises five rows 702 to 710. The columns in thetable of FIG. 7 are the same as those of FIG. 5 and will not bedescribed again in detail. The RF technology indicated in the RF columnis for example type

A for each of the rows. The columns INDEX, PATTERN and MASK in the tablefor example designate: in rows 702 and 704, code that selects the MF 0000 00; in row 706, code that selects the DF 00 00 01; in row 708, codethat selects any file; and in row 710, code that selects the DF 00 0002. The rule set required in rows 702, 706 and 708 of the table is 0x01,while the any rule set 0xXX can be active in rows 704 and 710 of thetable. In the case that row 702, 706 or 708 is selected, the NFC router202 is to process the message as being targeted to the UICC, whereas inthe case that row 704 or 710 is selected, the NFC router is to processthe message as being targeted to the eSE.

As with the table of FIG. 5, the table of FIG. 7 is applied byconsidering each row in turn from top down, in other words from row 702to row 710, and selecting the first row for which all of the conditionsare met.

It is assumed that a rule set 0x01 indicated in the table is a defaultrule set that is active following power up of the NFC router 202. Afirst frame following an anti-collision is received and the table isconsulted, the MF 00 00 00 is for example selected. Row 702 of the tableis thus selected, and the message is processed as being targeting to theUICC. For example, this means that the message is either routed to theUICC by the NFC router, and a response from the UICC is transmitted tothe external device, or the NFC router directly responds to the externaldevice in place of the assumed target.

The subsequent message from the external device may indicate that the DF00 00 01 is selected, in which case the row 706 of the table isselected, and this message is processed as being targeted to the UICC.

Alternatively, the subsequent message from the external device mayindicate that the DF 00 00 02 is selected, in which case the row 708 ofthe table is selected, given that the rule set 0x01 is active, and themessage is processed as being targeted to the U ICC. However, in thecase of DF 00 00 02, the target host is not the UICC, but the eSE.Therefore, this message will be discarded and/or a response to theexternal device will be generated comprising an error code. Thus, inaccordance with the DISABLE RULE column of row 708 of the table, therule set 0x01 is disabled. The external device will then make a newattempt, and because the rule set 0x01 is disabled, a new framedesignating the MF 00 00 00 will cause the row 704 of the table to beselected, such that the NFC router processes the message as beingdirected to the eSE. Furthermore, a subsequent frame designating the DF00 00 02 will cause row 710 of the table to be selected, and thus againthe NFC router will process the message as being directed to the eSE.

FIG. 8 illustrates a method of routing, by an NFC router of a mobiledevice, messages to a target host processing device, such as the devicehost or a secure element of the mobile device.

In a first step 802, the NFC router receives a first message from anexternal NFC device. For example, this first message may correspond tothe polling message of operation 604 of FIG. 6, or to a command receivedfollowing an anti-collision sequence in the example of the table of FIG.7 described above. In a subsequent step 804, in accordance with a firstactive rule, the first message is processed by the NFC router as beingtargeted to a first host processing device, which is for example themain processor of the mobile device. For example, the NFC router eitherroutes the first message to the first host processing device, orresponds by emulating the response of the first host processing device.The first active rule corresponds for example to the rule defined by row502 of the table of FIG. 5 or to the rule defined by row 702 of thetable of FIG. 7, in which the rule set 0x01 is active.

In a subsequent step 806, a second message is received by the NFC routerfrom the external NFC device, and the NFC router detects a bit patternin the second message indicating that the first host processing deviceis not the intended target host of the second message. For example, inthe embodiment of FIG. 5, the bit pattern is the fact that theinstruction code does not start with the hexadecimal value D, and theNFC identifier is that of the host processing device. In the embodimentof FIG. 7, the pattern is a code starting with 0x5A, but not comprisingthe MF 00 00 00 or the DF 00 00 01.

In a subsequent step 808, a second routing rule is activated. This forexample consists in simply deactivating the first rule set. For example,by deactivating the first rule set 0x01 and/or by activating anotherrule set in the tables of FIGS. 5 and 7, the rule defined by the rows504 and 704 of these tables can be activated.

In a subsequent step 810, a further first message is received by the NFCrouter.

In a subsequent step 812, the further first message is processed by theNFC router as being directed to the target host processing device, whichis for example a secure element of the mobile device, in accordance withthe second active routing rule.

An advantage of the embodiments described herein is that NFC messagescan be correctly routed to a target host while still routing messages bydefault to a host processing device, and while also respecting therequirement that only a single host device responds to the externaldevice for a given NFC message sequence.

Having thus described at least one illustrative embodiment, variousalterations, modifications and improvements will readily occur to thoseskilled in the art.

For example, while embodiments have been described with reference to arouting table, it will be apparent to those skilled in the art thatthere are other ways that the operations described herein could beimplemented without using a routing table.

Furthermore, while the tables of FIGS. 5 and 7 provide one example ofhow routing rules can be applied according to embodiments of the presentdisclosure, it will be apparent to those skilled in the art that otherimplementation are possible, for example omitting the mask and/or indexfields.

Some embodiments may take the form of computer program products. Forexample, according to one embodiment there is provided a computerreadable medium comprising a computer program adapted to perform one ormore of the methods described above. The medium may be a physicalstorage medium such as for example a Read Only Memory (ROM) chip, or adisk such as a Digital Versatile Disk (DVD-ROM), Compact Disk (CD-ROM),a hard disk, a memory, a network, or a portable media article to be readby an appropriate drive or via an appropriate connection, including asencoded in one or more barcodes or other related codes stored on one ormore such computer-readable mediums and being readable by an appropriatereader device.

Furthermore, in some embodiments, some or all of the systems and/ormodules may be implemented or provided in other manners, such as atleast partially in firmware and/or hardware, including, but not limitedto, one or more application-specific integrated circuits (ASICs),discrete circuitry, standard integrated circuits, controllers (e.g., byexecuting appropriate instructions, and including microcontrollersand/or embedded controllers), field-programmable gate arrays (FPGAs),complex programmable logic devices (CPLDs), etc., as well as devicesthat employ RFID technology. In some embodiments, some of the modules orcontrollers separately described herein may be combined, split intofurther modules and/or split and recombined in various manners.

The various embodiments described above can be combined to providefurther embodiments. Aspects of the embodiments can be modified, ifnecessary to employ concepts of the various patents, applications andpublications to provide yet further embodiments.

These and other changes can be made to the embodiments in light of theabove-detailed description. In general, in the following claims, theterms used should not be construed to limit the claims to the specificembodiments disclosed in the specification and the claims, but should beconstrued to include all possible embodiments along with the full scopeof equivalents to which such claims are entitled. Accordingly, theclaims are not limited by the disclosure.

1. A method, comprising: receiving by a near field communication (NFC)router of a mobile device, a first message from an external NFC deviceand, in accordance with a first rule, processing said first message asbeing targeted to a first processing device of said mobile device;receiving by said NFC router a second message from said external NFCdevice; detecting by said NFC router a bit pattern in said secondmessage indicating that said first processing device is not an intendedtarget of said second message and, when it is detected that the firstprocessing device in not the intended target of said second message,activating a second rule; and receiving by said NFC router a furtherfirst message from said external NFC device, and in accordance with saidsecond rule, processing said further first message as being targeted tosaid intended target processing device.
 2. The method of claim 1 whereinactivating said second rule comprises at least one of: storing in amemory an indication that said second rule is active; and storing in thememory an indication that said first rule is deactivated.
 3. The methodof claim 1, comprising accessing by said NFC router, in response toreceiving said first message, a lookup table identifying, based on atleast some of the data bits forming said first message and on whetherthe first or second rule is active, the first processing device.
 4. Themethod of claim 3, comprising accessing by said NFC router, in responseto receiving said further first message, said lookup table, wherein saidlookup table further identifies, based on at least some of the data bitsforming said further first message and on whether the first or secondrule is active, the intended target processing device.
 5. The method ofclaim 1, comprising transmitting by said NFC router, in response to saidfirst message, a response message to said external device.
 6. The methodof claim 5 wherein said response message comprises an identifier of saidfirst processing device, and wherein said bit pattern is a combinationin said second message of at least part of the identifier of said firstprocessing device and of one or more bits indicating an NFC applicationtype incompatible with said first processing device.
 7. The method ofclaim 1, comprising receiving via said NFC router a further secondmessage from said external NFC device and in accordance with said secondactive rule, routing said further second message to said intended targetprocessing device.
 8. The method of claim 7, comprising, prior toreceiving said further second message: transmitting by said NFC router,in response to said further first message, a further response message tosaid external device, said further response message comprising anidentifier of said intended target processing device, wherein saidfurther second message comprises said identifier of said intended targetprocessing device.
 9. The method of claim 1 wherein said intended targetprocessing device is a secure element of said mobile device.
 10. Themethod of claim 9 wherein said intended target processing deviceemulates the behavior of a contactless integrated circuit card.
 11. Themethod of claim 1 wherein said first message and said further firstmessage are polling messages of NFC RF transmission type F.
 12. A mobiledevice, comprising: a plurality of processing devices; and a near fieldcommunication (NFC) router, which, in operation: receives a firstmessage from an external NFC device and, in accordance with a firstrule, processes said first message as targeted to a first processingdevice of said mobile device; receives a second message from saidexternal NFC device; detects a bit pattern in said second messageindicating that said first processing device is not an intended targetprocessing device of said second message and, when the bit patternindicating said first processing device is not the intended targetprocessing device, activates a second rule; and receives a further firstmessage from said external NFC device, and in accordance with saidsecond rule, processes said further first message as targeted to saidintended target processing device.
 13. The mobile device of claim 12wherein said intended target processing device is a secure element ofsaid mobile device.
 14. The mobile device of claim 12 wherein saidintended target processing device is one of a subscriber identificationmodule (SIM) circuit and a universal SIM of said mobile device.
 15. Themobile device of claim 12, comprising a memory storing a lookup table,wherein, in operation, the NFC router selects an intended processingdevice based on the lookup table and at least some of the bits formingeach of said first messages and on whether the first or second rule isactive.
 16. A device, comprising: one or more memories; and processingcircuitry, which, in operation: receives a first message from anexternal near field communication (NFC) device and, in accordance with afirst rule, processes said first message as targeted to a firstprocessing device of a plurality of processing devices; receives asecond message from said external NFC device; determines, based on a bitpattern in said second message, whether said first processing device isan intended target processing device of said second message and, whenthe bit pattern indicates said first processing device is not theintended target processing device, activates a second rule; and receivesa third message from said external NFC device, and in accordance withsaid second rule, processes said third message as targeted to saidintended target processing device.
 17. The device of claim 16,comprising an NFC router including the processing circuitry and the oneor more memories.
 18. The device of claim 16 wherein the memory stores alook-up table and the processing circuitry, in operation, identifiesintended processing devices of the plurality of processing devices usingthe look-up table.
 19. The device of claim 16 wherein the first andthird messages are NFC polling messages.
 20. The device of claim 16,comprising the plurality of processing devices, wherein the plurality ofprocessing devices include a host processor of the device and at leastone secure element of the device.
 21. A non-transitory computer-readablemedium whose contents cause a near field communication (NFC) router toperform a method, the method comprising: processing a first message inaccordance with a first rule as being targeted to a first processingdevice; detecting, based on a bit pattern in a second message, whethersaid first processing device is an intended target of said secondmessage and, when it is detected that the first processing device in notthe intended target of said second message: activating a second rule;and processing a third message in accordance with said second rule asbeing targeted to the intended target processing device.
 22. The mediumof claim 21 wherein activating said second rule comprises at least oneof: storing in a memory an indication that said second rule is active;and storing in the memory an indication that said first rule isdeactivated.
 23. The medium of claim 21 wherein the method comprisesaccessing by said NFC router, in response to receiving a message, alookup table and identifying, based on at least some data bits of saidreceived message and on whether the first or second rule is active, anintended processing device of the received message.
 24. The medium ofclaim 21 wherein the NFC router is an NFC router of a mobile device andsaid first, second and third messages are received from an NFC deviceexternal to the mobile device.